package com.example.administrator.pregnancyassistence.fragment;


import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.example.administrator.pregnancyassistence.activity.DoActivity;
import com.example.administrator.pregnancyassistence.activity.EatActivity;
import com.example.administrator.pregnancyassistence.R;

public class BabyFragment extends Fragment {
    private View view;
    private ImageView imageViewEat;
    private LinearLayout whatdo;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        view=inflater.inflate(R.layout.baby_layout,container,false);
        imageViewEat=view.findViewById(R.id.eat);
        whatdo = view.findViewById(R.id.whatdo);
        imageViewEat.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View view, MotionEvent motionEvent) {
                Intent intent = new Intent(getActivity(),EatActivity.class);
                startActivity(intent);
                return false;
            }
        });
        whatdo.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(getActivity(), DoActivity.class);
                startActivity(intent);
            }
        });
        if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP){
            Window window=getActivity().getWindow();
            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            window.setStatusBarColor(Color.TRANSPARENT);
            window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
        }
        view.setFitsSystemWindows(true);
        return view;
    }



}
